/*
 *  Arrow
 *
 *  Created by David Giovannini on 1/5/07.
 *  Copyright 2007 Software by Jove. All rights reserved.
 *
 */
 
#ifndef SBJ_Arrow_DispatchStats_h
#define SBJ_Arrow_DispatchStats_h

namespace SBJ
{

namespace Arrow
{

class DispatchStats
{
public:
	struct Result
	{
		int subscriptions;
		int unsubscriptions;
		int executions;
		int visitBeginnings;
		int visitations;
		int cancelations;
		int deadCount;
		int blocking;
		int threaded;
	};

	DispatchStats( void ) { reset(); }

	~DispatchStats( void ) {}

	const Result& getResults( void ) const { return m_result; }

	void reset( void )
	{
		m_result.subscriptions		= 0;
		m_result.unsubscriptions	= 0;
		m_result.executions			= 0;
		m_result.visitBeginnings	= 0;
		m_result.visitations		= 0;
		m_result.cancelations		= 0;
		m_result.deadCount			= 0;
		m_result.blocking			= 0;
		m_result.threaded			= 0;
	}

	void accumeSubscribe( void ) { ++m_result.subscriptions; }

	void accumeUnsubscribe( void ) { ++m_result.unsubscriptions; }

	void accumeExecute( void ) { ++m_result.executions; }
	
	void accumeVisitBegin( void ) { ++m_result.visitBeginnings; }

	void accumeVisitations( int count ) { m_result.visitations+=count; }

	void accumeCancel( void ) { ++m_result.cancelations; }

	void accumeDead( void ) { ++m_result.deadCount; }

	void accumeBlocking( int count ) { m_result.blocking+=count; }

	void accumeThreaded( int count ) { m_result.threaded+=count; }

private:
	Result m_result;
};

}

}

#endif